UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3QBDi/Zo7RVcdqtTVGjCN2CMEAihCTvaUbSsowEQ4dI='
WHERE
key_id = 'e0e521d3460b762b846067b17f9ff8a2693a6a4b411695eea6eea924905ea965'
AND (
token = '3QBDi/Zo7RVcdqtTVGjCN2CMEAihCTvaUbSsowEQ4dI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)