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