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