UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7t1kb2Ow7jwZTEMuhFbLF9hULVphHCjRcS2XF39Eufs='
WHERE
key_id = 'd6f46dd3e768aa3afc81aac7ca0adfcd69f6225ce6745bdc7077b41b156f38b3'
AND (
token = '7t1kb2Ow7jwZTEMuhFbLF9hULVphHCjRcS2XF39Eufs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)