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