UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YflcE5A9dCKl8yyNyXArxg1hwV0Opff8omIMjXMZrcU='
WHERE
key_id = '07ab38fdd9d9c977489d7989c8a22b230feb381305b10523ca2f82f4c9a035c0'
AND (
token = 'YflcE5A9dCKl8yyNyXArxg1hwV0Opff8omIMjXMZrcU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)