UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VY1VrrmXgpXU4bd2zJRNTf4kTMb/svFwqIo2KsMjWig=' 
WHERE 
  key_id = '3c49996d3439b9026182ee5358f452e924e69427bb437953bf3b806a8ea152b9' 
  AND (
    token = 'VY1VrrmXgpXU4bd2zJRNTf4kTMb/svFwqIo2KsMjWig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051