UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qQscsdIA7sJjupq6m7j89JkudIiKk9HbC1pIfit+dbg=' 
WHERE 
  key_id = 'eece4fd3d4f8100adb3e6662a757562d129fe2ec59785da41e09ec57d465cad8' 
  AND (
    token = 'qQscsdIA7sJjupq6m7j89JkudIiKk9HbC1pIfit+dbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037