UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JiiIXOz5ppFVz7VMOfLIbBTXtaZcOtg0ZPG5xfaPBsY='
WHERE
key_id = '3c8a8ee2499ffe91f277089fdd2091b71e6417ddc09d8e164c47b94733ee7354'
AND (
token = 'JiiIXOz5ppFVz7VMOfLIbBTXtaZcOtg0ZPG5xfaPBsY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)