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

Query time 0.00029