UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k7tcUM1Zdz1Rufi2ZsvjM99v7ewk3kIVGaYoTIjosHQ='
WHERE
key_id = 'ff861a0cf39bf1ab46852ee51c58a933388f736caae4a012a9caa2f1edfe3cda'
AND (
token = 'k7tcUM1Zdz1Rufi2ZsvjM99v7ewk3kIVGaYoTIjosHQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)