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