UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nyIbGyfoGxi0a+wia1ZzVt221s2fSRDaC3mXzhiev+U='
WHERE
key_id = 'cf8f59797ae865cf7472189097b6b007d526f1c0204af257365f9640378abc25'
AND (
token = 'nyIbGyfoGxi0a+wia1ZzVt221s2fSRDaC3mXzhiev+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)