UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ApoQC+jr+NYThLw7VjORdOF7sNZTc61CLkecutkb8fM='
WHERE
key_id = 'c24989ba6ee1873c72e0dbc07e07a1ae3b1d448279f0dbf12307f95f5ffd0a56'
AND (
token = 'ApoQC+jr+NYThLw7VjORdOF7sNZTc61CLkecutkb8fM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)