UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2yPh2ubcocK1o5ZT5Qf2VkdfxNsEaTCDA1/iafBU5wU='
WHERE
key_id = '83b0ec22216f0717a38dbb79a0f0b6988a84043a9603e4c28079f66ef6ec0798'
AND (
token = '2yPh2ubcocK1o5ZT5Qf2VkdfxNsEaTCDA1/iafBU5wU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)