UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lVghZY6ocFaKktnOfkVtseVvcgG5arVCK5izEQoe+/c=' 
WHERE 
  key_id = '09bb8cd97d737803fb82d4f327eacde5df502e183ad97e544f0aa184daba8f53' 
  AND (
    token = 'lVghZY6ocFaKktnOfkVtseVvcgG5arVCK5izEQoe+/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016