UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W2eRhTdfUNJ8UE96OaxF4NcOTbo86O854k0XWIatFv8='
WHERE
key_id = 'ec7fd230480590b7f8b407397283b936355b2d57f6c6e55a51e5a09f903a2a18'
AND (
token = 'W2eRhTdfUNJ8UE96OaxF4NcOTbo86O854k0XWIatFv8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)