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