UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9RmveGWxmeP3JQboqYofIk+ZmPFIImHOychbFfa0vRU='
WHERE
key_id = '63b642a17fd297b5aeab4e45f4151985d2749589f592e0a8e1fe6f25e007def8'
AND (
token = '9RmveGWxmeP3JQboqYofIk+ZmPFIImHOychbFfa0vRU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)