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