UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6jJYGGYmZzm0L1bqrOEAx94fg1Nzn2BTrN6D+xJb9lY='
WHERE
key_id = 'c41071f9128561ba6163af888be4b2af38ee8b68b6f4e3abe9ef50e8757fc306'
AND (
token = '6jJYGGYmZzm0L1bqrOEAx94fg1Nzn2BTrN6D+xJb9lY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)