UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'riTNKhfi8Q4ucCJrVEmmsy/L5BdStxqy1sV+LrlsSBo='
WHERE
key_id = '3fae09c475c991b8eee7c032825e276562ee95734619fc2d1ae8c89af8a5e36c'
AND (
token = 'riTNKhfi8Q4ucCJrVEmmsy/L5BdStxqy1sV+LrlsSBo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)