UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PrV4RY9XEgUCFbQZLKpkIyIVVxVJYrcAoAjnbscg4iU='
WHERE
key_id = '51722c08cc82ca459289cc66e1c447340d83b4afb2de71e0bb0919bfa87b3902'
AND (
token = 'PrV4RY9XEgUCFbQZLKpkIyIVVxVJYrcAoAjnbscg4iU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)