UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n7jYZRKhReISBgFBVoyk0o7sl3hJn2q1jV/f9jyzcn8='
WHERE
key_id = 'cf6a6d02747f024f8e3a1f07f17947767d7b287d8cf46e17d0cc06977b12e23f'
AND (
token = 'n7jYZRKhReISBgFBVoyk0o7sl3hJn2q1jV/f9jyzcn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)