UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+u2d1kvT0NlDv2AXPk8v1m1n+hOntVvBjPVUQMoR1fc='
WHERE
key_id = 'ba04d44f95f2476ffd4853b1671e81f0873e22897456a329d00554d142bb5726'
AND (
token = '+u2d1kvT0NlDv2AXPk8v1m1n+hOntVvBjPVUQMoR1fc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)