UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T9LbPwykPHJV+hda/oPlwomNH9X5lcI40s50YDVA8cU='
WHERE
key_id = '1652e50195fd82eb9ccc2945705774542a53a44a52d18496d701ff6f8108a431'
AND (
token = 'T9LbPwykPHJV+hda/oPlwomNH9X5lcI40s50YDVA8cU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)