UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ABpHy0zMpaLIjO9BqtB5w8zPhQB6eAZryAzhZCv7DUI='
WHERE
key_id = '177851628f06bd1c82ff4fb4d59601016b5bd76685320c4841f5b657f547d340'
AND (
token = 'ABpHy0zMpaLIjO9BqtB5w8zPhQB6eAZryAzhZCv7DUI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)