UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ESfbps6rGW/AuCp5b6hGevU4pgTX7hmbocgbq7DPBvo='
WHERE
key_id = 'f7788023267a48004065a260a2606b1e330238c80906b2de36a68261d1bec82e'
AND (
token = 'ESfbps6rGW/AuCp5b6hGevU4pgTX7hmbocgbq7DPBvo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)