UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0z4DJ+r7zeLvkgI2cyt0G8rDdAuJGrtOWEEirJdYinM='
WHERE
key_id = '4e45b8ba83a99d84ba6da4320d5df753d15026ee9ad6797429985e5fb40ef438'
AND (
token = '0z4DJ+r7zeLvkgI2cyt0G8rDdAuJGrtOWEEirJdYinM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)