UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gf4GKgt+pOV8JLLpSV6PQ6nNlafPN0JSs0El8mRWhfA=' 
WHERE 
  key_id = '4d3a98c78b4f320ef72feb7a0e7afeee1ccd17cfde56d04d1835125638d16582' 
  AND (
    token = 'gf4GKgt+pOV8JLLpSV6PQ6nNlafPN0JSs0El8mRWhfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027