UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5YNCBJ1aY+4hOxALwz/KHokUE+d1JekFKVXFbsCsAIU=' 
WHERE 
  key_id = '258f373f1fe4ee4f28e57c2e2f7722289a3e5723d9da04ba81ce8871d38ea81a' 
  AND (
    token = '5YNCBJ1aY+4hOxALwz/KHokUE+d1JekFKVXFbsCsAIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036