UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xxp3pH6tTtTm0DDLKA40NiavWcjaTIEM2NkuWqGvk4I='
WHERE
key_id = '985e0d08083ba220687c0bc67f792a64dc8f64bc4951b1c9d0f379a61e868021'
AND (
token = 'Xxp3pH6tTtTm0DDLKA40NiavWcjaTIEM2NkuWqGvk4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)