UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wi1EYk9etI9lxsrUMhB1aBc4ifVg3ivsdHliQC8MVkQ='
WHERE
key_id = '88e8c6de672796421ca8e64bf7a3121c552bc120ea4af1329468c2a80907e90e'
AND (
token = 'wi1EYk9etI9lxsrUMhB1aBc4ifVg3ivsdHliQC8MVkQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)