UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zmef8+3x8s1ybeflZ5+tZdJapypvD8Fg5leYm2tmksc=' 
WHERE 
  key_id = 'b37fc696f901d5b171a042140989597127846e5238626dec2f935de839c5da15' 
  AND (
    token = 'Zmef8+3x8s1ybeflZ5+tZdJapypvD8Fg5leYm2tmksc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036