UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A3nc/1wX1ePKxlV2kT+32phcGbubALBUrdMMwiL0mZU=' 
WHERE 
  key_id = '6ac79d34974a740e999641ed97545603203d8887e7296878857d576d3d2aa518' 
  AND (
    token = 'A3nc/1wX1ePKxlV2kT+32phcGbubALBUrdMMwiL0mZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039